<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
 
class b2c_finder_brand{

    var $column_edit = '编辑';
    function column_edit($row){
        return '<a href="index.php?app=b2c&ctl=admin_brand&act=edit&_finder[finder_id]='.$_GET['_finder']['finder_id'].'&p[0]='.$row['brand_id'].'" target="_blank">'.app::get('b2c')->_('编辑').'</a>';
    }
    var $column_view = '查看';
    function column_view($row){

        return '<a href="'.kernel::base_url().'/index.php/brand-'.$row['brand_id'].'.html" target="_blank">'.app::get('b2c')->_('查看').'</a>';
    }

    /**
     *  品牌列表的供应商显示
     *  edit by kim
     **/
    var $column_business = '所属供应商';
    function column_business($row){
        $brand_id = $row['brand_id'];
        $brand_model = app::get('b2c')->model('brand');
        $bb_model = app::get('b2c')->model('business_brand');
        $basicmsg_model = app::get('b2c')->model('business_basicmsg');
        $arr = $brand_model->getList('has_bind',array('brand_id'=>$brand_id));
        foreach($arr as $a){
            $row['has_bind'] = $a['has_bind'];
        }
        if($row['has_bind']=='N'){
            return app::get('b2c')->_('未绑定');
        }else{
            $ids = $bb_model->getList('business_id',array('brand_id'=>$brand_id));
            
            foreach($ids as $k=>$v){
                $new[] = $ids[$k]['business_id'];
                //$row['english_all_name'][$k] = $list['english_all_name'];
                
            }
            //依据供应商IDbusiness_id，查询出全部所属供应商名称
            $list = $basicmsg_model->getList('english_all_name',array('business_id'=>$new));
            foreach ($list as $key => $value) {
                $temp[$key] = $value['english_all_name'];
            }
            //供应商名称组字符串，用逗号,隔开
            $row['english_all_name'] = implode("，  ",$temp);
            //echo '<pre>';
            //print_r($row['english_all_name']);
            //echo '</pre>';exit();
           // print_r($new);exit();
            return $row['english_all_name'];
        }
    }
}
